package com.wyg.service;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.wyg.dao.UserDao;

public class ChangePwdService {
	
	public HttpServletRequest request;
	public HttpServletResponse response;
	public UserDao ud = new UserDao();
	
	public ChangePwdService(HttpServletRequest request, HttpServletResponse response) {
		super();
		this.request = request;
	}
	//修改密码
	public void doChange(){
		int id = Integer.valueOf(request.getParameter("id"));
		String pwd = request.getParameter("pwd");
		
		ud.changePwd(id, pwd);
		
		try {
			response.sendRedirect("view/login.html");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	//激活
	public void doActive(){
		int id = Integer.valueOf(request.getParameter("id"));
		System.out.println(id);
		String status = "已激活";
		
		ud.changeStatus(id, status);
	}
}
